package com.supermap.qdsearch.app;

import android.app.Application;
import android.app.Service;
import android.os.Vibrator;

import com.baidu.mapapi.SDKInitializer;
import com.supermap.qdsearch.handler.CrashHandler;
import com.supermap.qdsearch.utils.LocationService;
import com.supermap.qdsearch.utils.Utils;
import com.yanzhenjie.nohttp.Logger;
import com.yanzhenjie.nohttp.NoHttp;

/**
 * Created by imooc on 2018/5/9.
 */

public class SearchApp extends Application {
    public LocationService locationService;
    public Vibrator mVibrator;
    //静态单例
    public static SearchApp instances;
    @Override
    public void onCreate() {
        super.onCreate();



        //初始化nohttp
        NoHttp.initialize(this);
        Logger.setDebug(true); // 开启NoHttp调试模式。
        Logger.setTag("NoHttpSample"); // 设置NoHttp打印Log的TAG。

        instances = this;

        //初始化工具类
        Utils.init(this);

        //初始化自定义异常捕捉类
        CrashHandler.getInstance().init(this);

        //初始化百度地图定位服务
        locationService = new LocationService(getApplicationContext());
        mVibrator =(Vibrator)getApplicationContext().getSystemService(Service.VIBRATOR_SERVICE);
        SDKInitializer.initialize(getApplicationContext());
    }
    public static SearchApp getInstances(){
        return instances;
    }

}
